package com.slz3.business.module.goodsManagement.gooBrand.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.goodsManagement.gooBrand.domain.GooBrand;
import com.slz3.business.module.goodsManagement.gooBrand.domain.GooBrandCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class GooBrandResController {

    @Resource
    private GooBrandResAtomic gooBrandResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, GooBrand gooBrand) {
        if (GooBrandResUnsafeValid.add(req, gooBrand)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.add_$GooBrandUpdateLock(req, gooBrand);
        }
    }

    public  Mono<ServerResponse> delete(ServerRequest req, GooBrandCondition gooBrandCondition) {
        if (GooBrandResUnsafeValid.delete(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.delete_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, GooBrand gooBrand) {
        if (GooBrandResUnsafeValid.modify(req, gooBrand)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.modify_$GooBrandUpdateLock(req, gooBrand);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (GooBrandResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooBrandResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
        if (GooBrandResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.info_$GooBrandUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (GooBrandResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooBrandResExecutor.choice(req);
        }
    }

    public final Mono<ServerResponse> auditSubmit(ServerRequest req, GooBrandCondition gooBrandCondition) {
        //
        if (GooBrandResUnsafeValid.auditSubmit(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.auditSubmit_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

    public final Mono<ServerResponse> audit(ServerRequest req, GooBrandCondition gooBrandCondition) {
        if (GooBrandResUnsafeValid.audit(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.audit_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

    public final Mono<ServerResponse> auditReject(ServerRequest req, GooBrandCondition gooBrandCondition) {
        if (GooBrandResUnsafeValid.auditReject(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.auditReject_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

    public final Mono<ServerResponse> usingEnable(ServerRequest req, GooBrandCondition gooBrandCondition) {
        if (GooBrandResUnsafeValid.usingEnable(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.usingEnable_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

    public final Mono<ServerResponse> usingDisable(ServerRequest req, GooBrandCondition gooBrandCondition) {
        if (GooBrandResUnsafeValid.usingDisable(req, gooBrandCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBrandResAtomic.usingDisable_$GooBrandUpdateLock(req, gooBrandCondition);
        }
    }

}
